function sum(goods){
    const sum = document.querySelector(".sum");
    const sumPrice = document.querySelector(".sumPrice");
    // 计算总数量
    sum.innerHTML = goods.reduce((prev,val)=>prev+val.num, 0);

    // 计算总价
    sumPrice.innerHTML = goods.reduce((prev,val)=>prev + val.num*val.price, 0);
}


export default sum;